package cm.day14.Test4;

import org.junit.Test;

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ResourceBundle;

public class Demo {
    @Test
    public void show() throws ClassNotFoundException, NoSuchFieldException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException {
        ResourceBundle bundle=ResourceBundle.getBundle("config");
        //获取key的值
        String className = bundle.getString("className");

        //根据key获取value值
        Class clz = Class.forName(className);
//
        //创建对象（）
        Object obj = clz.getConstructor().newInstance();
        Method method = clz.getDeclaredMethod("run");
        method.setAccessible(true);
        Object invoke = method.invoke(obj);
//        System.out.println(invoke);
//
//

    }

}
